<template>
  <div>
    <slot name="insertFooter"></slot>
    <el-button v-bind="cancelButtonProps" @click="handleCancel" v-if="showCancelBtn">
      {{ cancelText }}
    </el-button>
    <slot name="centerFooter"></slot>
    <el-button
      :type="okType"
      @click="handleOk"
      :loading="confirmLoading"
      v-bind="okButtonProps"
      v-if="showOkBtn"
    >
      {{ okText }}
    </el-button>
    <slot name="appendFooter"></slot>
  </div>
</template>
<script setup lang="ts">
  import type { ModalProps } from '../typing'

  defineProps<ModalProps>()

  const emits = defineEmits(['ok', 'cancel'])

  function handleOk(e: Event) {
    emits('ok', e)
  }

  function handleCancel(e: Event) {
    emits('cancel', e)
  }
</script>
